package database;

import java.sql.*;

public class Transcation
{
	// database name and Deriver mananger direcotry.
	public static String JDRIVER = "com.mysql.jdbc.Driver";
	public static String DATABASE_URL = "jdbc:mysql://localhost/airline";
	protected static Connection connect; 
	
	public static void connectToDatabase()
	{
		// connect impelemten
		connect = null;
		try {
				// The newInstance() call is a work around for some
				// broken Java implementations
				Class.forName(JDRIVER);
				
				//DATABASE_URL = DATABASE_URL + arg[0];
				
			connect = DriverManager.getConnection(DATABASE_URL, "root" , "mysql198585");
			
			

		}
		catch (SQLException ex) {
         // handle any errors
				System.out.println("SQLException: " + ex.getMessage());
				System.out.println("SQLState: " + ex.getSQLState());
				System.out.println("VendorError: " + ex.getErrorCode());
		}
		catch (ClassNotFoundException classNotFound)
		{
			classNotFound.printStackTrace();
			System.exit(1);
		} 
		
		return;
	}//end of connectToDatabase.
	
	
	//public  abstract void updateDatabase();
	//public  abstract void queryDatabase(String query);
}
